package io.renren.modules.web.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.modules.sys.dao.SysUserDao;
import io.renren.modules.sys.entity.SysUserEntity;
import io.renren.modules.sys.service.SysUserService;
import io.renren.modules.web.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("teacherService")
public class TeacherServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> implements TeacherService {
    @Autowired
    private SysUserService sysUserService;


    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        List<SysUserEntity> list = sysUserService.getTeacherPage(params);
        int totalCount = sysUserService.getTeacherCount(params);
        int currPage = Integer.parseInt((String) params.get("page"));
        int pageSize = Integer.parseInt((String) params.get("limit"));
        return new PageUtils(list, totalCount, pageSize, currPage);
    }
}